<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="com.yls.except.util.GeneralResult" %>
<%@ page import="com.yls.except.util.StringIsempty" %>
<%@ page import="org.json.JSONArray" %>
<%@ page import="org.json.JSONObject" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">
    <title>发货列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

    <!-- 加载Css 样式 -->
    <title>订单详情---关于多方发货生成订单的页面</title>

    <link href="css/NotSendOrderDetails_Css.css" rel="stylesheet" type="text/css"/>

    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/public.js"></script>
    <script type="text/javascript" src="js/json2.js"></script>
    <script type="text/javascript" src="js/indent/repertoryindentinfo.js"></script>
    <script>
        function back() {
            window.history.back(-1);
        }
    </script>
</head>
<body style="background-color: #f4f4f4;">
<jsp:include page="/public.jsp"/>
<!-- 固定的title 样式 -->
<%--<header class="header">--%>
    <%--<div align="left" class="a">--%>
        <%--<img src="img/arrow_eft_circle.png" style="padding: 10px;height: 28px; width: 28px;" onclick="back()"/>--%>
    <%--</div>--%>

    <%--<div align="center" class="a">--%>
        <%--<span style="padding: 15px;font-size: 20px;color: white;">发货列表</span>--%>
    <%--</div>--%>

    <%--<div align="right" class="a">--%>
        <%--<img src="img/more.png" style="padding: 10px;height: 28px;width: 28px;"/>--%>
    <%--</div>--%>
<%--</header>--%>

<div>
    <%
        String jsonstr = request.getParameter("indentinfo");
        Map<String, Object> map = GeneralResult.jsonStrToMap(jsonstr);
        String totalfreight = "0.00";
        String isenough = "";
        String sparemoney = "";
        String typeid = "";
        if (!StringIsempty.isNullMap(map)) {
            JSONArray jsonArray = (JSONArray) map.get("indent");
            typeid = map.get("typeid") + "";
            isenough = map.get("isenough") + "";
            sparemoney = map.get("sparemoney") + "";
            totalfreight = map.get("totalfreight") + "";
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject jsonObject = (JSONObject) jsonArray.get(i);
                JSONArray repertory = (JSONArray) jsonObject.get("repertory");
    %>
    <!-- 生成一条订单项 -->
    <div class="order_number">
        <span>订单编号:<%=jsonObject.get("indentnum")%></span>
    </div>
    <hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>
    <!-- 生成一条订单项 -->
    <div class="address">
        <span>收货地址</span>
    </div>

    <hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>

    <!-- 加载地址 -->

    <div>
        <div class="show_address">
            <div class="left">
                <img class="img_size" src="img/consignee.png"/>
                <span class="username"><%=jsonObject.get("name")%></span>
            </div>
            <div class="right">
                <img class="img_size" src="img/cellphone.png"/>
                <span class="phone"><i><%=jsonObject.get("phone")%></i></span>
            </div>
        </div>

        <div class="clearboth"></div>

        <div class="show_address_out">
            <div class="address_div">
                <img class="img_size" src="img/address.png"/>
            </div>
            <div style="width: 85%;float: left;margin-bottom: 15px;">
                <span class="address"><%=jsonObject.get("address")%></span>
            </div>
        </div>

        <div style="height: 3px;">
            <img src="img/Addsplit.png" class="address_hr"/>
        </div>
    </div>

    <!-- 实现订单列表 -->

    <div class="store_name">
        <div style="float: left;">
            <img src="img/logo_icon.png" class="add_img"/>
            <span>摘记良品</span>
        </div>
        <div style="float: right;">
            <img src="img/right.png" class="right_img"/>
        </div>
    </div>
    <!-- 自定以  hr -->
    <hr style="height: 1px; width: 100%; background-color: #f4f4f4; border: none;"/>
    <%
        for (int j = 0; j < repertory.length(); j++) {
            JSONObject repertoryinfo = repertory.getJSONObject(j);
    %>
    <!-- 商品详情 -->
    <div class="goods">
        <img src="<%=repertoryinfo.get("img")%>" class="item_img" onerror="imgerror(this,'img/onerror.png');"/>
        <ul class="item_ul">
            <li><span class="item_name"><%=repertoryinfo.get("shop_name")%></span></li>
            <li>
                <div style="margin-top: 10px;">
                    <span class="item_desc"><%=repertoryinfo.get("name")%></span>
                    <span class="item_buy_num">X<%=repertoryinfo.get("chosenum")%></span>
                </div>
            </li>
            <li><span class="item_money">￥:<%=repertoryinfo.get("price")%></span></li>
        </ul>
    </div>
    <!-- 自定以  hr -->
    <hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>
    <%
        }
    %>
    <!-- 运费 -->
    <div class="trans_div">
        <span class="tran_span">运费</span>
        <span class="tran_money">￥<i><%=jsonObject.get("freight")%></i></span>
    </div>
    <!-- 自定以  hr -->
    <hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>

    <div class="trans_div">
        <span class="span_all_money">￥<i><%=jsonObject.get("freight")%></i></span>
        <span class="span_all_money">小计</span>
    </div>
    <%
            }
        }
    %>

</div>
<!-- 底部按钮 -->
<div class="footer">
    <hr style="height: 1px;  background-color: #f4f4f4; border: none;"/>
    <div class="div_left">
        <div class="left">
            <span class="all">合计运费:</span>
            <span class="left_span">￥<%=totalfreight %></span>
        </div>
    </div>
    <div class="next" onclick="showPopup();">
        <span class="next_span">确认发货</span>
    </div>
</div>


<div id="background" style="background: rgba(0,0,0,0.5);height: 100%;width: 100%;position: fixed;top: 0;display: none;"></div>
<div class="cqchoosenum">
    <div class="pop_pay">
        <div class="pop_title">
            <div class="pop_cancel">
                <img src="img/cancel.png" onclick="showPopup();"/>
            </div>
            <div class="title">支付信息</div>
        </div>
        <hr style="height: 1px; width: 100%; float: right; background-color: #f4f4f4; border: none;"/>
        <div class="clearboth"></div>
        <div class="pay_styl" id="paytype">
            <span class="span_one">支付方式</span>
            <%
                if("true".equals(isenough)) {
            %>
            <input class="radio_type" type="radio" id="spare_pay" name="paytype" checked="checked" value="1"/> <span class="span_two">余额(￥<i><%=sparemoney%></i>)</span>
            <input class="radio_type" type="radio" id="wechat_pay" name="paytype" value="2"/> <span class="span_two">微信支付</span>
            <%
                } else {
            %>
            <input class="radio_type" type="radio" id="spare_pay" name="paytype" value="1" disabled="disabled"/> <span class="span_two">余额(￥<i><%=sparemoney%></i>)</span>
            <input class="radio_type" type="radio" id="wechat_pay" name="paytype" checked="checked" value="2"/> <span class="span_two">微信支付</span>
            <%
                }
            %>
        </div>
        <hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>
        <div class="pay_money_div">
            <span style="font-size: 16px;">应付金额</span>
            <span class="pay_money">￥:<i id="money"><%=totalfreight %></i></span>
        </div>
        <!-- 确认支付 -->
        <div id="buy" class="buy_bg" onclick="pay_indent('<%=typeid%>');">
            <span style="width: 90%;font-size: 16px;color: white;">确认支付</span>
        </div>
    </div>
</div>

<jsp:include page="/files/public_hint.jsp"/>
</body>
</html>